import Vue from 'vue';
import Vuex from 'vuex';
import getters from './getters';
import user from '@/store/modules/user';
import permission from '@/store/modules/permission';
// import createPersistedState from 'vuex-persistedstate';

Vue.use(Vuex);

const modules = {
  user,
  permission,
};

const store = new Vuex.Store({
  modules,
  // plugins: [createPersistedState({
  //   reducer(val) {
  //     return {
  //       // 只储存state中的router_id and routes
  //       router_id:val.user.router_id,
  //       routes: val.permission.routes
  //     }
  //   }
  // })],
  getters,
});

window.store = store;
export default store;
